module global
  use param
  implicit none
  ! integration points
  integer :: ngi
  ! run mode
  integer :: rmode,xmode,pmode
  ! minimum energy for displacement
  real(dbl) :: dise
  ! minimum energy for sub-cascade 
  real(dbl) :: sube
  ! xsec input
  real(dbl) :: xmine,xmaxe,xeh,xih
  integer :: nhx,nix
  character(len=len_fn) :: xfn
  ! power input
  real(dbl) :: pmine,pmaxe,peh,pih
  integer :: nhp,nip
  character(len=len_fn) :: pfn
  ! output
  character(len=len_fn) :: outfn
  ! subcascade parameter
  real(dbl) :: next_e
  integer :: int_n
  ! file for recoil spectrum
  character(len=len_fn) :: rfn
  ! material info
  real(dbl) :: amass,acharge,ndensity
  ! kernel
  real(dbl) :: e2,mtoev,kl,km,kq,kex,ikq,ka,k1,k2,k3,k4
  ! Recoil spectrum
  integer :: n_rspec,n_egrid
  real(dbl) :: sum_rspec
  real(dbl),pointer,dimension(:) :: egrid,rgrid,rspec,rspec1,rspec2,rspec3,rspec4
  ! Save subcascad density
  real(dbl),pointer,dimension(:) :: res
  ! Recursive parameres
  integer :: max_grid,n_split,ncall
  real(dbl),pointer,dimension(:) :: e_split
  
  ! Derived data type
  type data1
     real(dbl) :: maxe,mine
     integer :: ndata,pos
     real(dbl),pointer,dimension(:) :: e,x
  end type data1
  ! Save xsec
  type(data1) :: nstop
  ! Save nstop
  type(data1) :: xsec
end module
